#include "ntddk.h"
#include "ia32_types.h"
 
extern "C" void __stdcall Asm_cpuid(ULONG_PTR nIndex, ULONG32 *szArrary);
extern "C" void __stdcall Asm_cpuidByParam(ULONG_PTR nIndex, PVOID szArrary);
extern "C" void __stdcall Asm_rdmsr(ULONG32 nIndex, ULONG64 *pReadBuffer);
extern "C" void __stdcall Asm_wrmsr(ULONG32 nIndex, ULONG64 nWriteValue);
extern "C" ULONG_PTR __stdcall Asm_readCr0();
extern "C" void __stdcall Asm_WriteCr0(ULONG_PTR nCr0Value);
extern "C" ULONG_PTR __stdcall Asm_readCr2();
extern "C" void __stdcall Asm_WriteCr2(ULONG_PTR nCr2Value);
extern "C" ULONG_PTR __stdcall Asm_readCr3();
extern "C" void __stdcall Asm_WriteCr3(ULONG_PTR nCr3Value);
extern "C" ULONG_PTR __stdcall Asm_readCr4();
extern "C" void __stdcall Asm_WriteCr4(ULONG_PTR nCr4Value);
extern "C" ULONG_PTR __stdcall Asm_Vmxon(void *pVmxOnStruct);
extern "C" char __stdcall Asm_Invept(InvEptType invept_type, InvEptDescriptor *invept_descriptor);
extern "C" char __stdcall Asm_Invvpid(InvVpidType invvip_type, InvVpidDescriptor *invvpid_descriptor);
extern "C" bool __stdcall Asm_VmClear(void *region_pa);
extern "C" bool __stdcall Asm_Vmptrld(void *region_pa);
extern "C" void __stdcall Asm_VmxOff();
extern "C" ULONG64 __stdcall Asm_InitializeVM(PVOID pFunction, void *context);
extern "C" void __stdcall Asm_SGDT(void *pBuffer);
extern "C" void __stdcall Asm_SIDT(void *pBuffer);
extern "C" void __stdcall Asm_LGDT(void *pBuffer);
extern "C" void __stdcall Asm_LIDT(void *pBuffer);
extern "C" ULONG_PTR __stdcall Asm_vmxWrite(ULONG32 nIndex, ULONG64 nValue);
extern "C" USHORT __stdcall Asm_readES();
extern "C" USHORT __stdcall Asm_readCS();
extern "C" USHORT __stdcall Asm_readSS();
extern "C" USHORT __stdcall Asm_readDS();
extern "C" USHORT __stdcall Asm_readFS();
extern "C" USHORT __stdcall Asm_readGS();
extern "C" USHORT __stdcall Asm_readTR();
extern "C" USHORT __stdcall Asm_readldtr();
extern "C" ULONG_PTR __stdcall AsmLoadAccessRightsByte(ULONG_PTR selector);
extern "C" ULONG_PTR __stdcall Asm_readEflags();
extern "C" void __stdcall AsmVmmEntryPoint();
extern "C" void __stdcall Asm_launch();
extern "C" ULONG_PTR __stdcall Asm_readCr8();
extern "C" void __stdcall Asm_WriteCr8(ULONG_PTR nRcx);
extern "C" ULONG_PTR __stdcall Asm_VmRead(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_Xsetbv(ULONG nRcx, ULONG_PTR nRdx);
extern "C" void __stdcall AsmInvalidateInternalCaches();
extern "C" void __stdcall Asm_Rdtsc(ULARGE_INTEGER *pLargeInteger);
extern "C" ULONGLONG __stdcall Asm_Rdtscp(unsigned int *pBuffer);
extern "C" ULONG_PTR __stdcall Asm_VmCall(HypercallNumber szCallType, void *pProcessorData);

extern "C" ULONG_PTR __stdcall Asm_readDr0();
extern "C" ULONG_PTR __stdcall Asm_readDr1();
extern "C" ULONG_PTR __stdcall Asm_readDr2();
extern "C" ULONG_PTR __stdcall Asm_readDr3();
extern "C" ULONG_PTR __stdcall Asm_readDr6();
extern "C" ULONG_PTR __stdcall Asm_readDr7();

extern "C" void __stdcall Asm_writeDr0(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_writeDr1(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_writeDr2(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_writeDr3(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_writeDr6(ULONG_PTR nRcx);
extern "C" void __stdcall Asm_writeDr7(ULONG_PTR nRcx);

extern "C" ULONG_PTR __stdcall Asm_GetJmpCodeStart();
extern "C" ULONG_PTR __stdcall Asm_GetJmpCodeLen();
extern "C" ULONG_PTR __stdcall Asm_GetAgentAsmFunctionStart();
extern "C" ULONG_PTR __stdcall Asm_GetAgentAsmFunctionLen();
extern "C" ULONG_PTR __stdcall Asm_GetAddressValueAsmFunctionStart();
extern "C" ULONG_PTR __stdcall Asm_GetAddressLenAsmFunction();
extern "C" ULONG_PTR __stdcall Asm_GetAddressQwordValueAsmFunctionStart();
extern "C" ULONG_PTR __stdcall Asm_GetAddressQwordValueLenAsmFunction();